package test.util;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @author ASUS
 * @version V1.0
 * @Project es
 * @Package com.qf.utils
 * @Date 2021/11/3 15:45
 */
public class ElasticsearchUtil {

    private static final String HOST = "192.168.37.37";
    private static final int PORT = 9200;

    public static RestHighLevelClient getClient(){
        HttpHost httpHost = new HttpHost(HOST, PORT);
        RestClientBuilder builder = RestClient.builder(httpHost);
        RestHighLevelClient client = new RestHighLevelClient(builder);
        return client;
    }
}
